home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 03 Pathfinding with Astar / 01 Matthews / ase / aseDoc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-07-06  |  2.7 KB  |  108 lines

  1.  
  2. #ifndef _AFX_ASEDOC_H_
  3. #define _AFX_ASEDOC_H_
  4.  
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif
  8.  
  9. #define ASE_GRIDSIZE    8
  10. #define ASE_BOARDX        320
  11. #define ASE_BOARDY        240
  12.  
  13. #include "pathfinder.h"
  14. #include "nodeview.h"
  15. #include "aseview.h"
  16.  
  17. class CAseDoc : public CDocument
  18. {
  19. protected:
  20.     CAseDoc();
  21.     DECLARE_DYNCREATE(CAseDoc)
  22.  
  23. public:
  24.     bool    SetDiagonal(int);
  25.     bool    Stepping() { return m_bStepped; }
  26.     bool    GetDiagonal() { return m_bAllowDiagonal; }
  27.     bool    DrawRoute() { return m_bDrawRoute; }
  28.     char    *GetBoard() { return &(m_cBoard[0][0]); }
  29.  
  30.     void    NodeAdded(_asNode *, int);
  31.     void    NotifyClick();
  32.     void    DrawNode(_asNode *);
  33.     void    GetStartEnd(CPoint &x, CPoint &y) { x = m_cStart, y = m_cEnd; }
  34.     void    SetStartEnd(CPoint x, CPoint y) { m_cStart = x, m_cEnd = y; }
  35.     void    SetBreakpoint(CPoint bp) { m_cBreakpoint = bp; m_iBreakData = -1; }
  36.  
  37.     CPoint  GetBreakpoint() { return m_cBreakpoint; }
  38.     CAStar *GetPathFinder() { return &m_cAStar; }
  39.  
  40.     static int AS_Valid(_asNode *, _asNode *, int, void *);
  41.     static int AS_Cost(_asNode *, _asNode *, int, void *);
  42.     static int AS_RelativeCost(_asNode *, _asNode *, int, void *);
  43.  
  44.     //{{AFX_VIRTUAL(CAseDoc)
  45.     public:
  46.     virtual BOOL OnNewDocument();
  47.     virtual void Serialize(CArchive& ar);
  48.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  49.     //}}AFX_VIRTUAL
  50.  
  51. public:
  52.     virtual ~CAseDoc();
  53. #ifdef _DEBUG
  54.     virtual void AssertValid() const;
  55.     virtual void Dump(CDumpContext& dc) const;
  56. #endif
  57.  
  58. protected:
  59.     bool        m_bStepped;
  60.     bool        m_bBreakpointHit;
  61.     bool        m_bDrawRoute;
  62.     bool        m_bContinualUpdate;
  63.     bool        m_bAllowDiagonal;    
  64.     bool        m_bRelativeCosting;
  65.     char        m_cBoard[ASE_BOARDX][ASE_BOARDY];
  66.     int            m_iBreakData;
  67.     
  68.     CPoint        m_cStart;
  69.     CPoint        m_cEnd;
  70.     CPoint        m_cBreakpoint;
  71.     UINT        m_uBrushType;
  72.  
  73.     _asNode        *m_pcBreakNode;
  74.  
  75.     CAStar        m_cAStar;
  76.  
  77.     bool        SetupAStar(bool stepped = false);
  78.     
  79.     inline void    MessageBox(CString, CString, UINT);
  80.  
  81.     CNodeView    *GetNodeView();
  82.     CAseView    *GetAseView();
  83.     
  84.     //{{AFX_MSG(CAseDoc)
  85.     afx_msg void OnRunToBreakpoint();
  86.     afx_msg void OnUpdateRunToBreakpoint(CCmdUI* pCmdUI);
  87.     afx_msg void OnExecuteAStar();
  88.     afx_msg void OnStepAStar();
  89.     afx_msg void OnPathingAllowDiagonal();
  90.     afx_msg void OnUpdatePathingAllowDiagonal(CCmdUI* pCmdUI);
  91.     afx_msg void OnViewARoute();
  92.     afx_msg void OnUpdateViewARoute(CCmdUI* pCmdUI);
  93.     afx_msg void OnPathingContinuousUpdate();
  94.     afx_msg void OnUpdatePathingContinuousUpdate(CCmdUI* pCmdUI);
  95.     afx_msg void OnPathingRelativeCosting();
  96.     afx_msg void OnUpdatePathingRelativeCosting(CCmdUI* pCmdUI);
  97.     //}}AFX_MSG
  98.     afx_msg void OnBrushType(UINT);
  99.     afx_msg void OnUpdateUIBrushType(CCmdUI *);
  100.     afx_msg void OnBreakpointType(UINT);
  101.     afx_msg void OnUpdateUIBreakpointType(CCmdUI *);
  102.     DECLARE_MESSAGE_MAP()
  103. };
  104.  
  105. //{{AFX_INSERT_LOCATION}}
  106.  
  107. #endif
  108.